<html>
<head>
	<link rel="stylesheet" type="text/css" href="<?php echo base_url()?>assets/grocery_crud/css/font-awesome.min.css">
	<link rel="stylesheet" type="text/css" href="<?php echo base_url()?>assets/grocery_crud/css/ui/simple/jquery-ui-1.10.1.custom.min.css">
	<script type="text/javascript" src="<?php echo base_url()?>assets/grocery_crud/js/jquery-1.10.2.min.js"></script>
	<link rel="stylesheet" type="text/css" href="<?php echo base_url()?>assets/grocery_crud/css/app.css">
	<script type="text/javascript" src="<?php echo base_url()?>assets/grocery_crud/js/jquery_plugins/ui/minified/jquery.ui.core.min.js"></script>
	<script type="text/javascript" src="<?php echo base_url()?>assets/grocery_crud/js/jquery_plugins/ui/minified/jquery.ui.widget.min.js"></script>

	<script type="text/javascript" src="<?php echo base_url()?>assets/grocery_crud/js/jquery_plugins/ui/minified/jquery.ui.button.min.js"></script>
	<script type="text/javascript" src="<?php echo base_url()?>assets/grocery_crud/js/jquery_plugins/ui/minified/jquery.ui.menu.min.js"></script>
	<script type="text/javascript" src="<?php echo base_url()?>assets/grocery_crud/js/jquery_plugins/ui/minified/jquery.ui.slider.min.js"></script>
	<script type="text/javascript" src="<?php echo base_url()?>assets/grocery_crud/js/jquery_plugins/ui/minified/jquery.ui.datepicker.min.js"></script>
	<title></title>
</head>
<body>
	<style type="text/css">
body,table td,table th{
	font-family: DroidSans;
	font-size: 12px;
}
.t{
	text-align: center;
}
#nama_field_box{
	width: 420px !important;
	margin:2px auto;
	width: 370px; 
}
	</style>
<h3 class="t"><i class="fa fa-print"></i>&nbsp;Tabel Nilai Pernegara</h3>
<form method="post" action="<?php echo site_url('rekap/nilai_pernegara')?>">
<input type="hidden" name="doPrint" value="yes">
<div align="center">
	<div style="text-align:left;width:400px" class="portlet">

	<table>
		<tbody><tr>
			<td><strong>Periode</strong></td>
			<td> : </td>
			<td>
			<input type="text" class="calText" id="d1" size="10" value="" name="d1">
			s/d
			<input type="text" class="calText" id="d2" size="10" value="" name="d2">
			</td>
		</tr>
		<tr>
			<td><strong>Jumlah Negara Muat</strong></td>
			<td> : </td>
			<td>
				<select name="jml">
					<option value="5">5</option>
					<option value="10">10</option>
					<option value="15">15</option>
					<option value="20">20</option>
					<option value="0">All</option>
				</select>
			</td>
		</tr>
		<tr>
			<td colspan="3" align="center"><br/>
<div id="rsCount" style="color:green;display:none"></div>
<br/></td>
		</tr>	
		<tr>
			<td colspan="2">&nbsp;</td>
			<td>
			<input type="submit" value="Tampilkan" style="cursor:pointer" id="tampil">
			<input type="reset" style="cursor:pointer">
			</td>
		</tr>
	</tbody></table>

	</div>
</div>
</form>

</body>
</html>
<script type="text/javascript">
$(document).ready(function(){
	$('#d1').datepicker({dateFormat: 'dd/mm/yy',changeYear:true,changeMonth:true});
	$('#d2').datepicker({dateFormat: 'dd/mm/yy',changeYear:true,changeMonth:true});


	$('#d1,#d2').change(function(){
		var dt_start = $('#d1').val();
		var dt_end = $('#d2').val();
		var jml = $('select[name=jml]').val();

		if(dt_start.length && dt_end.length ){
			$('#rsCount').text('Calculating ......').show();
			$.post('<?php echo base_url()?>rekap/nilai_pernegara?count=yes',{'d1':dt_start,'d2':dt_end,'jml':jml},function(r){
				$('#rsCount').html('Total values : <b>' + r + '</b> .');
				if(parseInt(r) > 0)
					$('#tampil,#excel').removeAttr('disabled');
				else
					$('#tampil,#excel').attr('disabled','disabled');
			});
			
		}else{
			$('#tampil').attr('disabled','disabled');

		}
	}).change();

	$('#atur').click(function(){
		$('#tampil,#excel').attr('disabled','disabled');
		$('#rsCount').hide('');
	});
});
</script>